<template>
    <el-container class="main">
        <el-header class="header df ai-c">
            <com-header></com-header>
        </el-header>
        <el-container>
            <el-aside style="width:auto;" class="aside">
                <menu-list />
            </el-aside>
            <el-main class="main-contain">
                <div v-if="!linkurl" class="df ai-c" style="padding:50px;">
                    <el-input v-model="link" placeholder="地址" style="width:300px;margin-right:50px;"></el-input>
                    <el-button type="primary" @click="inputLink">确定</el-button>
                </div>
                <div v-if="linkurl" style="height:100%;">
            	    <router-view :linkurl="linkurl" :baseurl="baseurl" :domain="domain"></router-view>
                </div>
            </el-main>
        </el-container>
    </el-container>
</template>

<script>
import menu from "../components/menu.vue";
import header from "../components/header.vue";
import { mapState } from 'vuex';

export default {
    data(){
        return {
            baseurl: "/install/app/xxx/founder/micro",
            roles: false,
            role: 0,
            link: "",
            linkurl: "",
            domain: "",
            menu: [],
            iframe: false,
        }
    },
    components: {"menu-list":menu, "com-header":header},
    computed: {...mapState(['roleInfo'])},
    created(){
        console.log("gggggggg")
        console.log(this.roleInfo)
        if(this.roleInfo){
            this.roles = this.roleInfo.roles;
            this.menu = this.roleInfo.menu;
            this.linkurl = this.roleInfo.linkurl;
            this.iframe = this.roleInfo.iframe;
            this.domain = this.roleInfo.domain;
        }
        this.changeIframe();
    },
    methods: {
        inputLink(){
            this.linkurl = this.link;
            sessionStorage.setItem("linkurl",this.link);
        },
        changeIframe(){
            this.baseurl = "/install/app/xxx/founder"+(this.iframe?"/iframe":"/micro");
        },
    },
    watch:{
        iframe(){
            this.baseurl = "/install/app/xxx/founder"+(this.iframe?"/iframe":"/micro");
        }
    }
}
</script>

<style scoped >
.wi{font-size:22px;}
.header{height:50px; background-color: #242b35; color:#ffffff;}
.aside{background-color: #1c222b;}
.main{min-height:100vh;}
.main-contain{padding:0; height:calc(100vh - 50px); overflow:auto;}
</style>